home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / utility / utilcli / random.lha / Random.p < prev   
Text File  |  1996-11-14  |  882b  |  41 lines

  1. Program Random;
  2.  
  3. { *** Random - show a random number ***
  4.       v1.1 © JIPsoft 14th Nov 1996
  5.  Usage: Random <max>, where max is the maximum
  6.  value for the random number
  7.  
  8.  This program is freely distributable         }
  9.  
  10. {$I "Include:Utils/Random.i"}
  11. {$I "Include:Utils/Parameters.i"}
  12. {$I "Include:Utils/Stringlib.i"}
  13.  
  14. var cline: string;
  15.     seed: integer;
  16.  
  17. Function StringConvert(source: string): integer;
  18. var c: char;
  19.     result,index: integer;
  20. begin
  21.     result:=0;
  22.     index:=0;
  23.     c:=source[index];
  24.     while (c>='0') and (c<='9') do begin
  25.         result:=(10*result)+(ord(c)-ord('0'));
  26.         index:=index+1;
  27.         c:=source[index]
  28.    end;
  29.    StringConvert:=result
  30. end;
  31.  
  32. begin
  33.     if 1=2 then
  34.         writeln('$VER: Random v1.1 by JIPsoft');
  35.     cline:=AllocString(255);
  36.     GetParam(1,cline);
  37.     seed:=StringConvert(cline);
  38.     SelfSeed;
  39.     writeln(RangeRandom(seed))
  40. end.
  41.